package com.gof.example.observer;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Created by zhiyuan on 2018/5/12 19:31.
 * haiming.fei@tongdun.cn
 */
public abstract class Observerable {

    private List<Observer> observers = new ArrayList<>();

    public List<Observer> getObservers() {
        return observers;
    }

    public void follow(Observer o) {
        observers.add(o);
    }

    public void unfollow(Observer o) {
        observers.remove(o);
    }

    abstract void changePrice(double increase);
}
